<template>
  <div class="con">
    <el-container>
      <el-main style="padding:0;">
        <!-- 充值提现 -->
        <div class="contbox6_10">
          <p class="titlelist6_10">
            系统日志
            <span style="color: #999;">&nbsp;&nbsp;/&nbsp;&nbsp;</span>系统日志
          </p>
          <div class="content">
            <div class="sousuojg6_10">
              <el-form :model="formInline" label-width="100px">
                <el-form-item label="操作用户">
                  <el-input
                    v-model="formInline.createBy"
                    placeholder="请输入操作用户"
                  ></el-input>
                </el-form-item>
                <el-form-item style="width:350px" label="日期">
                  <el-date-picker
                    v-model="dataTime"
                    type="daterange"
                    range-separator="至"
                    start-placeholder="开始日期"
                    end-placeholder="结束日期"
                    value-format="yyyy-MM-dd"
                  ></el-date-picker>
                </el-form-item>
              </el-form>
            </div>
            <div class="buttons">
              <el-button v-if="isAuth('logSearch')" type="primary" @click="queryPayActiveList"
                >搜索</el-button
              >
              <el-button v-if="isAuth('logReset')" type="" @click="result">重置</el-button>
            </div>
            <el-table
              :data="tableData"
              :header-cell-style="{ background: '#F9FAFC', color: '#222' }"
              stripe
              border
              @selection-change="handleSelectionChange"
              :row-style="{ height: '0px' }"
              :cell-style="{ padding: '0px' }"
              v-loading="listLoading"
            >
              <el-table-column
                type="index"
                width="100"
                label="序列号"
              ></el-table-column>
              <el-table-column
                prop="createDate"
                width="160"
                label="日期"
              ></el-table-column>
              <el-table-column
                show-overflow-tooltip
                min-width="160"
                prop="officeName"
                label="机构名称"
              >
              </el-table-column>
              <el-table-column
                prop="createBy"
                min-width="160"
                label="操作用户"
              ></el-table-column>
              <el-table-column
              show-overflow-tooltip
                prop="title"
                min-width="300"
                label="操作内容"
              ></el-table-column>
            </el-table>
            <el-pagination
              background
              style="text-align: right;"
              class="pagination"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="formInline.page"
              :page-size="formInline.number"
              layout="total, sizes, prev, pager, next, jumper"
              :page-sizes="[20, 50, 100]"
              :total="totalNum"
            ></el-pagination>
          </div>
        </div>
      </el-main>
    </el-container>
  </div>
</template>
<script type="text/ecmascript-6">
import bus from '../../assets/js/bus'
import https from '../../plugins/https'
import qs from 'qs'
export default {
  data() {
    return {
      formInline: {
        createBy: '',
        startDate: '',
        endDate: '',
        page: 1,
        number: 20
      },
      dialogTableData: [],
      dataTime: [],
      eventShow: false,
      machinesShow: false,
      listLoading: false,
      totalNum: 0, //总页数
      form: {},
      tableData: [],
      activityType: 1,
      activeUid: '',
    };
  },
  components: {
  },
  mounted () {
    this.queryPayActiveList()
  },
  methods: {
    // 列表渲染
    queryPayActiveList () {
      this.listLoading = true
      if (this.dataTime === null) this.dataTime = []
      this.formInline.startDate = this.dataTime[0]
      this.formInline.endDate = this.dataTime[1]
      https.sysLogList(this.formInline).then(res => {
        if (res.data.code !== '0000') {
          layer.open({
            content: res.data.msg,
            skin: "msg",
            time:  2 //1秒后自动关闭
          });
          // this.$notify({title: "错误",message: res.data.msg,type: "error"});
          this.listLoading = false
          return
        }
        this.tableData = res.data.data
        this.totalNum = res.data.total
        this.listLoading = false
      })
    },
    result(){
      this.formInline.createBy = ""
      this.formInline.startDate = ""
      this.formInline.endDate = ""
      this.dataTime = null
      this.formInline.page=1
       this.queryPayActiveList()
    },
    payActiveListExport() {
      window.location.href =  `/api/account/earnDetail/excel/export?${qs.stringify(this.formInline)}`;
    },
    handleSizeChange(val) {
      this.formInline.number = val; //动态改变
      this.queryPayActiveList()
    },
    handleCurrentChange(val) {
      this.formInline.page = val; //动态改变
      this.queryPayActiveList()
    },
  }
};
</script>
<style scoped>
.con {
  position: relative;
}
.elbtn {
  float: right;
  margin: 20px;
}
.img {
  display: block;
  width: 100%;
}
.money p {
  width: 100%;
  line-height: 30px;
}
.status {
  font-size: 14px;
  margin-bottom: 20px;
}
.color {
  color: #e6a23c;
}
.mt20 {
  margin-top: 20px;
}
.shopList {
  width: 100%;
  border-bottom: 1px solid #ccc;
  line-height: 80px;
  font-size: 16px;
}
.formItem {
  float: left;
}
.pagination {
  margin-top: 10px;
}
.btn {
  float: right;
  margin-left: 10px;
}
.content {
  min-width: calc(100% - 40px);
}
.buttons > .el-button {
  width: 100px;
  padding: 7px;
  height: 32px;
}
</style>
